<?php
namespace Ftt;
/**
 * Created by PhpStorm.
 * User: yy
 * Date: 16-10-27
 * Time: 下午9:47
 */
class Controller
{
    /**
     * @var View $view
     */
    protected $view;

    protected function getView(){
        if($this->view instanceof View){
            return $this->view;
        }

        return $this->view = new View();
    }

    public function __construct()
    {
        $this->init();
    }

    public function init(){}

    /**
     * @param string $viewName
     * @param array $data
     */
    public function render($viewName, $data = []){
        $this->getView()->render($viewName, $data);
    }
}